CC=gcc
CXX=g++
CFLAGS=-pipe -Wall -W -fPIC
CXXFLAGS=-pipe -Wall -W -fPIC
LINK=g++
PREFIX=/usr/local
TARGET=libQeffectsGL.so
TARGET_VERSION=$(TARGET).1

LFLAGS=-shared -Wl,-soname,$(TARGET_VERSION)

DEL_FILE=rm -f
LIBS=-ldl
SYMLINK=ln -sf

SOURCES=source/qfx_settings.cpp \
source/qfx_shader.cpp \
source/qfx_log.cpp \
source/qfx_hooks.cpp \
source/qfx_renderer.cpp \
source/qfx_library.cpp \
source/qfx_opengl.cpp

OBJECTS = $(SOURCES:.cpp=.o)

first: all

.SUFFUXES: .o .cpp

.cpp.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"


all: Makefile $(TARGET)

$(TARGET):  $(OBJECTS) 
	-$(DEL_FILE) $(TARGET)
	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) 
	

clean:
	-$(DEL_FILE) $(OBJECTS)
	-$(DEL_FILE) $(TARGET)

install: all
	@mkdir -p $(PREFIX)/lib
	cp $(TARGET) $(PREFIX)/lib
	$(SYMLINK) $(PREFIX)/lib/$(TARGET) $(PREFIX)/lib/$(TARGET_VERSION)

uninstall:
	rm -f $(PREFIX)/lib/$(TARGET)
	rm -f $(PREFIX)/lib/$(TARGET_VERSION)


